<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <div>{{msg}}</div>
        <menu-item title='来自父组件的固定数据'></menu-item>
        <menu-item :title='ptitle' test='可选属性'></menu-item>
    </div>

    <script src="../../js/vue.js"></script>
    <script>
        Vue.component("menu-item", {
            data() {
                return {
                    msg: '子组件本身的数据'
                }
            },
            props: ['title', 'test'],
            template: '<div>{{title}} ---- {{test}} ---- {{msg}}</div>'
        })
        var vm = new Vue({
            el: '#app',
            data: {
                msg: '父组件的数据',
                ptitle: '父组件绑定数据'
            }

        })
    </script>
</body>

</html>